package org.example.completed.controller;

import org.example.completed.domain.AnimalCategory;
import org.example.completed.service.AnimalService;
import org.example.completed.utils.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class AnimalController {

    private final AnimalService animalService;

    @Autowired
    public AnimalController(AnimalService animalService) {
        this.animalService = animalService;
    }

    // 获取所有可领养的动物，按种类分类
    @GetMapping("/getAllAdoptableAnimals")
    public ApiResponse<List<AnimalCategory>> getAllAdoptableAnimals() {
        List<AnimalCategory> animals = animalService.getAllAdoptableAnimals();
        return ApiResponse.success(animals, "获取成功");
    }
}
